Maintainer & Support
- Maintainer: Reza Seydi
- Email: mohammad.seydi@umu.se
- Issues: Please open an issue here:
https://github.com/mr-seydi/PowerShinyApp/issues
The Power ShinyApp is a web-based interactive application developed using R’s Shiny framework. The developed app is designed to perform statistical power analysis for Two-Sample/Population Functional Hypothesis Test (Functional/Curve data) using multiple statistical methods. The application supports multiple data inputs, interactive visualisation, and statistical power computation to provide a flexible tool for simulation-based power analysis.
# 1) Install R and RStudio (see detailed instructions below if you need help)
# 2) Get the code
# Option A: download ZIP from GitHub, then unzip and cd into the folder
# Option B: clone with Git
git clone https://github.com/mr-seydi/PowerShinyApp.git
cd PowerShinyApp
# 3) Open in RStudio and install packages
# In R console:
install.packages(c("shiny")) # or use renv::restore() if renv.lock exists
# 4) Run the app
## From RStudio
# 1. Double-click `Power_ShinyApp.Rproj` to open the project.
# 2. In the Console, run: shiny::runApp()
# Shiny will automatically find `ui.R` and `server.R` in the project root.
## From Terminal
# Since this app has ui.R and server.R in the project root:
R -e "shiny::runApp('.', host='127.0.0.1', port=3838)"
Check your R version:
R.version.string
Download R from CRAN: https://cran.r-project.org/bin/windows/base/
Run the installer and accept the defaults unless you need a custom location.
(Optional, CLI) If you use Chocolatey, open Admin PowerShell and run:
choco install r.project -yDownload the latest R pkg from CRAN: https://cran.r-project.org/bin/macosx/
Double-click the .pkg and follow the
prompts.
(Optional, Homebrew):
brew install --cask rUbuntu/Debian:
sudo apt update
sudo apt install -y r-baseFedora/RHEL/CentOS:
sudo dnf install -y RArch:
sudo pacman -S --noconfirm rFor system libraries needed by certain R packages (e.g.,
libcurl,openssl,xml2), see your distro docs.
.deb/.rpm).git clone https://github.com/mr-seydi/PowerShinyApp.git
cd PowerShinyApp
https://github.com/mr-seydi/PowerShinyApp.Project structure (example):
PowerShinyApp/ ├─ ui.R ├─ server.R ├─ Power_ShinyApp.Rproj ├─ R/ # helper functions ├─ www/ # static assets (css/js/images) ├─ data/ # data files (if any) ├─ renv.lock # pinned package versions (if using renv) └─ README.md
Open the project in RStudio (double-click
Power_ShinyApp.Rproj) or set your working directory to the
repo root:
setwd("/path/to/PowerShinyApp")
renv (recommended)If the repo includes an renv.lock file, run:
install.packages("renv")
renv::restore() # installs exact package versions from renv.lock
Double-click Power_ShinyApp.Rproj to open the
project.
In the Console, run:
shiny::runApp()
Shiny will automatically find ui.R and
server.R in the project root.
Run Shiny on a specific host/port:
R -e "shiny::runApp('.', host='0.0.0.0', port=3838)"
Then open: http://localhost:3838
Power ShinyApp is your Tool for Statistical Power Analysis for Two-Sample/Population Functional Hypothesis Test. It provides a user-friendly platform for conducting advanced statistical power analyses of functional (curve) data. Whether you are in academia or industry, it simplifies complex calculations, enabling accurate, valid and efficient study planning, sample size estimation and data interpretation.
Choose how you want to create or upload mean functions (curves) for your two-group/population comparison:
|
|
|
|
|
|
Assume you have preliminary data gathered during a pilot study — a small-scale preliminary study to test the procedures and instruments of a larger, main study. This data helps researchers refine their methodology, estimate necessary sample sizes for the full study, identify potential problems, and assess the feasibility of their research.
The dataset you upload must have the following structure:
After uploading the dataset, you will select two groups of individual curves for analysis. The estimated smoothness (Noise FWHM) and the standard deviation of the noise functions will guide you in choosing the appropriate parameters for the next step.
If your raw data has a different number of evaluation points, you can
resample to 101 evaluation points using the following R helper function
(requires the fda package):
library(fda)
data_to_101evalpoints <- function(data){
# data: matrix with rows = original time/eval points, columns = functions
data_to_fd <- Data2fd(argvals = 0:(nrow(data) - 1), y = data)
rangeval <- data_to_fd$basis$rangeval
eval.points <- seq(rangeval[1], rangeval[2], length.out = 101)
final_data <- eval.fd(fdobj = data_to_fd, evalarg = eval.points)
return(final_data)
}
This section allows you to define the characteristics of both the noise and, if applicable, the signal used in your analysis or simulation. Adjusting these parameters changes how the app generates or interprets your data, giving you full control over the input conditions.
Based on the parameters you choose, the app displays three plots side by side to help you visualize the data and check whether your settings make sense.
1. Baseline Data
|
|
|
2. Two-Sample Data
|
|
|
3. Custom Curve
|
|
|
4. Pilot Data
|
|
|
The calculated statistical power is shown on the right side of this tab.
R not found / wrong version
R.version.string/usr/local/bin or
/opt/homebrew/bin precedes older R paths.Packages fail to compile on Windows
Packages fail to compile on macOS
xcode-select --installLinux missing system libs
libcurl, openssl,
libxml2, harfbuzz, fribidi,
freetype, etc., via your package manager.Port already in use
shiny::runApp(port = 4242)App can’t find files
White screen / nothing loads
options(shiny.fullstacktrace = TRUE).cd PowerShinyApp
git pull
# If using renv:
R -e "renv::restore()"
If you use this app in academic work, please cite this paper:
Sample Size Estimation for Functional Data Analysis with Web Application
Mohammad Reza Seydi, Johan Strandberg, Todd C. Pataky, and Lina Schelin
https://github.com/mr-seydi/PowerShinyApp/issues